Skip to content

Conversation

Pawelusze
Copy link

Make Notice`s package-private

@Pawelusze Pawelusze requested a review from a team as a code owner October 6, 2025 20:10
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily refactors message classes to use package-private visibility for Notice fields, improving encapsulation. It also consolidates sound-playing logic for join, quit, and chat events into their respective controllers, which is a good structural improvement.

However, I've found a critical issue in BroadcastCommand where the executeTitle method has been refactored in a way that breaks its functionality by not replacing placeholders and introducing confusing behavior. I've also spotted a minor typo in the gradlew script. My detailed feedback and suggestions are in the comments below.

Comment on lines +41 to +45
this.noticeService.create()
.notice(translation -> Notice.title(raw ? " " : translation.broadcast().messageFormat(), text,
this.settings.titleFadeIn(), this.settings.titleStay(), this.settings.titleFadeOut()))
.onlinePlayers()
.send();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The new implementation of executeTitle seems to have a few issues:

  1. Placeholder Not Replaced: The title is set from translation.broadcast().messageFormat() when not in raw mode. This format string likely contains placeholders like {BROADCAST} which are not being replaced. This will result in players seeing the literal placeholder string.
  2. Unclear Functionality: The command has been changed to broadcast a "combined title message", and executeSubtitle has been removed. However, the implementation always uses the input text as the subtitle, and the title is either a space or the unformatted format string. This is a confusing and likely incorrect behavior. It's also a breaking change that isn't documented in the PR description.

If the intention is for this command to now broadcast a subtitle (as executeSubtitle was removed), you could reuse the sendBroadcast helper method which correctly handles placeholder replacement.

Here is a suggested implementation that would make /broadcast title behave like the old /broadcast subtitle:

Suggested change
this.noticeService.create()
.notice(translation -> Notice.title(raw ? " " : translation.broadcast().messageFormat(), text,
this.settings.titleFadeIn(), this.settings.titleStay(), this.settings.titleFadeOut()))
.onlinePlayers()
.send();
this.sendBroadcast(
formatted -> Notice.title("", formatted, this.settings.titleFadeIn(), this.settings.titleStay(), this.settings.titleFadeOut()),
text,
raw
);

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
this.noticeService.create()
.notice(translation -> Notice.title(raw ? " " : translation.broadcast().messageFormat(), text,
this.settings.titleFadeIn(), this.settings.titleStay(), this.settings.titleFadeOut()))
.onlinePlayers()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

te zmiany na pewno są do tego PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jeszcze widzę parę usuniętych plików

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oj przez przypadek się połączyły poprawie to ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants